package models

import "goapp-web-server/app/utils/orm"

type SysUser struct {
	Model    `xorm:"extends"`
	UserName string      `json:"username" xorm:"user_name"`
	Password string      `json:"password" xorm:"password"`
	Enabled  bool        `json:"enabled" xorm:"enabled"`
	UserInfo SysUserInfo `json:"userInfo" xorm:"extends"`
}

type SysUserInfo struct {
	Model    `xorm:"extends"`
	UserId   string `json:"user_id" xorm:"user_id"`
	Email    string `json:"email" xorm:"email"`
	NickName string `json:"nick_name" xorm:"nick_name"`
	Avatar   string `json:"avatar" xorm:"avatar"`
	Age      int8   `json:"age" xorm:"age"`
}

func (u SysUser) TableName() string {
	return "sys_user"
}

func (i SysUserInfo) TableName() string {
	return "sys_user_info"
}

func init() {
	orm.RegisterModel(&SysUser{})
	orm.RegisterModel(&SysUserInfo{})
}
